//
//  Enemy.cs
//
//  Author:
//       Philipp Schröck <philsch@hotmail.de>
//
//  Copyright (c) 2013 Philipp Schröck
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
using System;

namespace libcharakter
{
    public enum EnemySize
    {
        KleinerAlsWinzig = +10,
        Winzig = +8,
        SehrKlein = +6,
        klein = +4,
        MittelGroß = +2,
        Groß = 0,
        SehrGroß = -2,
    }
    public enum DeckungMod
    {
        HalbeDeckung,
        DreiViertelDeckung,
        Daemmerung,
        Mondlicht,
        Sternenlicht,
        Finsternis,
        Dunst,
        Nebel,
        InBewegung,
        Ausweichen,
        Stehend,
        Unbeweglich
    }

    [Serializable]
    public class Enemy
    {
        EnemySize m_size;
        DeckungMod[] m_deckung;
        int m_SizeDeckungMod;
        int m_rs;

        public EnemySize Size { get { return m_size; } }
        public DeckungMod[] Deckung { get { return m_deckung; } set { m_deckung = value; CalcShootMod(); } }
        public int ShootModifikation { get { return m_SizeDeckungMod; } }
        public int RuestungsSchutz { get { return m_rs; } protected set { m_rs = value; } }

        public Enemy(EnemySize size)
        {
            m_size = size;
            m_rs = 0;
            m_deckung = new DeckungMod[] { DeckungMod.Stehend };
            CalcShootMod();
        }
        public Enemy(EnemySize size, DeckungMod[] dekung)
        {
            m_size = size;
            m_rs = 0;
            m_deckung = dekung;
            CalcShootMod();
        }


        private void CalcShootMod()
        {
            int mod = (int)m_size;

            foreach (var item in m_deckung)
            {
                switch (item)
                {
                    case DeckungMod.HalbeDeckung:
                    case DeckungMod.Daemmerung:
                    case DeckungMod.Dunst:
                        mod += 2;
                        break;
                    case DeckungMod.DreiViertelDeckung:
                    case DeckungMod.Mondlicht:
                    case DeckungMod.Nebel:
                    case DeckungMod.InBewegung:
                        mod += 4;
                        break;
                    case DeckungMod.Sternenlicht:
                        mod += 6;
                        break;
                    case DeckungMod.Finsternis:
                        mod += 8;
                    case DeckungMod.Stehend:
                        mod += -2;
                        break;
                    case DeckungMod.Unbeweglich:
                        mod += -4;
                        break;
                }
            }
            m_SizeDeckungMod = mod;
        }

    }
}

